package main

import (
  "context"
  "fmt"
  "google.golang.org/grpc"
  "google.golang.org/grpc/credentials/insecure"

  pb "safeguardgrpc"
)

func main() {
    conn, err := grpc.Dial("172.31.2.121:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
    if err != nil {
      panic("failed to dial: " + err.Error())
    }
    defer conn.Close()
    stub := pb.NewNetworkControllerClient(conn)
    //response, err := stub.List(context.Background(), &pb.NetworkListRequest("ALLOWED"))
    response, err := stub.Create(context.Background(), &pb.NetworkRequest{Action:"ALLOWED", Hostname:"localhost", PID:1, Comm:"test", ParentComm:"testparent", Addr:"/root/", Domain:"test", Port:"111", Protocol:"tcp"})
    if err != nil {
        panic("failed to print: " + err.Error())
    }
    fmt.Println(response)
}

